
const  login = (code) =>  {

	return new Promise((reject,resolve)=>{
		uni.request({
			url:getApp().globalData.baseUrl + '/user/login',
			method:'POST',
			timeout:5000,
			header:{
				 'content-type': 'application/x-www-form-urlencoded'
			},
			data:{
				code:code
			},success:res=>{
				if(res.data.code == 20000 || res.data.code == 19999){
					reject(res.data)
				}else{
					resolve(new Error(res.data.msg))
				}
			},fail:res=>{
				console.log(res)
				resolve(new Error("获取数据失败"))
				
			}
			
		})
	})
	
}

module.exports = {
	login
}